1. Field of the Invention
The present invention generally relates to a pulse detection technique. Particularly, it is concerned with a pulse detection circuit for detecting pulses contained in output signals derived from an encoder such as a rotary encoder which coverts any physical quantity like spatial position, displacement or length into an electric signal.
2. Description of the Prior Art
In general, a rotary encoder is used to generate output signals A and B of different phase simultaneously in response to the rotation of a shaft 2, being projected from a body 1 thereof as shown by FIG. 1. Numbers of the output pulses of the signals A and B issued from the terminals 3 and 4 of the encoder, respectively, correspond to the rotational angle of the shaft 2, which is then detected by counting the pulses contained in the output signals A and B. In FIG. 1, numeral 5 represent a common terminal. It is needless to say that the larger the number of pulses per rotation of the shaft 2 contained in the output signal of the rotary encoder, the higher the accuracy of the detection of the rotational angle of the shaft 2 will be.
Namely, any physical quantity is converted into a rotational motion of the shaft 2 of the rotary encoder, which can convert a change in the physical quantity into a change in an electric signal, usually a digital data composed of the pulses. And by counting these pulses by a counter composed of an IC, an accurate measurement of the physical quantity can be made in an easy and simple manner.
Incidentally, the output signals A and B, derived from the rotary encoder, are usually designed to have pulse sequences of phases being shifted with each other as shown in FIG. 2. By detecting this phase shift, the rotary encoder shown in FIG. 1 can discriminate the rotational direction of the shaft 2 based on a relative phase difference, whether it rotates clockwisely or anti-clockwisely. As a pulse detection circuit for detecting the phase shift between the pulses contained in both of the encoder output signals to discriminate the rotational direction, and for generating a control signal, the following circuits have hitherto been known to the art.
One example of such a conventional circuit includes the use of an up-down counter 6 shown in FIG. 3, wherein one of the encoder output signals is fed to the clock input terminal CP and the other is fed to the up-down input terminal UP/DOWN of the up-down counter 6, respectively. According to this arrangement, the up-down counter 6 counts the rise-up edge of the pulse contained in the encoder output signal A, which is fed to the clock input terminal CP. Hence the up-down counter assumes an "up" state in response to one level, for instance, a high level (hereinafter, simply referred to as "H" level) of the encoder output signal B, which is fed to the up-down input terminal UP/DOWN, while it assumes its "down" state in response to an opposite level, i.e., a low level ("L" level).
As indicated above, if the encoder output signals A and B are fed to the clock input terminal CP and the up-down input terminal UP/DOWN of the up-down counter 6, respectively, the counter 6 counts downwardly by the clockwise rotation of the encoder shaft and counts upwards by the anticlockwise rotation shown in FIG. 2, discriminatively. The cumulated count value of this up-down counter indicates the rotational direction and angle of the encoder shaft.
Another example of the conventional measure includes the use of a logic circuit composed of an exclusive OR gate 9, three AND gates 10, 11 and 12, and an inverter 13, shown in FIG. 4. In this logic circuit, the rise-up edge of the pulse contained in the encoder output signal A is detected by the exclusive OR gate 9 in combination with the AND gate 10 to generate a pulse signal at the output terminal of the AND gate, which output signal is fed to the one input terminals of the AND gates 11 and 12. This output signal therefore causes either of the AND gates 11 and 12 to issue a pulse signal, on the basis of the level in the encoder output signal B at each time when the rise-up edge of the signal A is detected. Namely, a pulse signal is issued from the AND gate 11, if the encoder output signal B is in its "H" level, whereas the pulse signal is issued from the AND gate 12, if the signal B is in its "L" level. An output terminal 7 of this logic circuit therefore issues an output signal if the encoder shaft rotate anti-clockwisely and another output terminal 8 issues an output signal if the encoder shaft rotate clockwisely.
These output signals are then counted by a conventional counter to give a desired control signal.
Two major disadvantages are, however, inherent to those conventional arrangements, and will be described below.
One of the major disadvantages is a liability of causing an erroneous counting. In general, the encoder as shown in FIG. 1 may be embodied in an optical or mechanical contact system, from which an output signal in an ideal rectangular waveform as depicted in FIG. 2 cannot usually be obtained. On the contrary, it cannot avoid an incident of a chattering sudden burst of noise (chattering noise) at or adjacent to rise-up or fall-down edge of the pulse contained in its output signal because of the instability or the like in the contacts at the times of its closing or opening. If the chattering noise occurs, erroneously many numbers of pulses would be contained in the encoder output signal, which is to be received by, for instance, the clock input terminal CP of the up-down counter shown in FIG. 3 to cause a count value higher than the actual count.
In order to prevent such an erroneous count due to the chattering, use of a low pass filter (LPF) comprising an integral circuit composed of a capacitor and a resister has hitherto been proposed. The encoder output signal is fed to the detection circuit through the LPF. In a case wherein, the period of the encoder output signal is approximately constant, in the other words, the rotational frequency of the shaft 2 is constant, the above-mentioned means of using a LPF is fairly effective, because the time period during which the chattering occurs (chattering time) is almost constant. However, the length of the chattering time generally depends on the length of the period or pulse duration of the encoder output signal, and hence is usually varying. Therefore, if the LPF is adjusted to be effective for an encoder output signal in a state of long period (corresponding to a low rotational frequency of the shaft) by enlarging the time constant of the integral circuit, the response of the detecting circuit will become insufficient when the period is shortened and the circuit itself will be unable to count the pulse properly. Conversely, if the LPF is adjusted to be effective for an encoder output signal in a state of short period (a high rotational frequency), the possibility of the detecting circuit commiting an erroneous counting will be made greater when the period is elongated, because the LPF cannot absorb the chattering.
Another major disadvantage of the conventional technique is in a possibility of commiting an erroneous counting at a time of changing the rotational direction of the encoder shaft. This will be elucidated in detail by referring to FIG. 5, wherein the pulse sequences in the encoder output signals A and B are represented by waveforms with respect to relation angles in the first and second lines respectively, while the third line schematically indicates the example of changings of rotational direction of the encoder. When the shaft of the encoder rotates in the direction indicated by arrows, the circuit counts up at point 14 and 15 which correspond to a rise-up edges of the pulses contained in the encoder output signal A. Next, if the rotational direction of the shaft is changed immediately after passing point 15, the circuit counts down not at point 15' but at point 16 which corresponds to a rise-up edge with respect to the leftward direction of the pulse contained in the encoder output signal A. Thereof as indicated above, an error represented by "m" in FIG. 5 which is a distance from point 15' to point 16 occurs during the while the detecting circuit counts up at the point 15 and counts down at the point 16 after the change in the rotational direction. Furthermore, if the rotational direction is changed again before passing the point 16 as indicated by an arrow along a broken line in FIG. 5, the detecting circuit counts up again at a point 17 and returning rotation is not represented by the output. Therefore, if such motion of broken line arrows are repeated, a cumlative error value will be greater.